<template>
  <div>
    <table class="table">
      <thead>
          <tr>
            <th>友情名称</th>
            <th>友情链接</th>
            <th>友情描述</th>
            <th>接受邮箱</th>
            <th>处理状态</th>
          </tr>
      </thead>
      
      <tbody>
           <Friendsbody @updateSiteCoed="updateSiteCoed"  :site="item" v-for="(item,index) in sity" :key="index"></Friendsbody>
      </tbody>
    </table>
  </div>
</template>

<script>
  import Friendsbody from '@/components/friendstbody.vue'
export default {
  components:{
    Friendsbody
  },
  data(){
    return{
      choose: '0',
      sity:[
        {
          siteName:"北辞s",
          siteHref:"www.baidu.com",
          siteMessage:"小北辞",
          siteEmail:"746",
          siteCode:"1"
        },
        {
          siteName:"北辞",
          siteHref:"www.bai2s22du.com",
          siteMessage:"小北辞",
          siteEmail:"746",
          siteCode:"2"
        },
        {
          siteName:"北辞",
          siteHref:"www.bai2som",
          siteMessage:"小北辞",
          siteEmail:"746",
          siteCode:"2"
        }
      ]
    }
  },
  methods:{
    initData(){
       this.$http.get("/getSiteAll").then((va)=>{ 
           this.sity=va.data.object
       })
    },
    updateSiteCoed(ev){
        this.$http.post("/UpdateSityCode",this.qs.stringify({
          "id":ev.id,"code":ev.code
        })).then((va)=>{
          if(va.data.object){
            alert("修改成功")
          }else{
            alert("修改失败 ")
          }
        })
    }
  },
  created(){
    this.initData()
  }
}
</script>

<style lang="less" scoped>
  .table{
    width: 100%;
    // background: red;
    thead{
      color: saddlebrown;
      font-size: 14px;
      // line-height: 30px;
    }
    tbody{
      text-align: center;
      line-height: 60px;

    
    }
  }
@media screen and (max-width: 782px) {
    .table {
        font-size: 10px;
    }
}
</style>